package com.klhappy.houyuan.modle;

import android.content.Context;
import android.util.Log;

import com.klhappy.houyuan.bean.EvaluateOrder.OrderJsonBean;
import com.klhappy.houyuan.constant.KeyConstant;
import com.klhappy.houyuan.constant.UrlConstant;
import com.klhappy.houyuan.utils.BaseModel;
import com.klhappy.houyuan.utils.ConfigManager;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by MrPu on 15/12/12.
 */
public class DingDanModle extends BaseModel {

    private Map<String ,String> params = new HashMap<>();

    private ConfigManager manage;

    private String cookie;

    public DingDanModle(Context context) {
        super(context);
        manage = new ConfigManager(context);
        cookie = manage.get(KeyConstant.session, cookie);
    }

    //获取待付款详情
    public void getPay(){
        String path = UrlConstant.ORDER_LIST_URL;
        cookie = manage.get(KeyConstant.session, cookie);
        params.put("or_status" , "1");
        Callback(path ,params ,cookie);
    }
    //获取待送货详情
    public void getSend(){
        String path = UrlConstant.ORDER_LIST_URL;
        cookie = manage.get(KeyConstant.session, cookie);
        params.put("or_status" , "2");
        Callback(path ,params ,cookie);
    }
    //获取评价详情
    public void getEvaluate(){
        String path = UrlConstant.ORDER_LIST_URL;
        cookie = manage.get(KeyConstant.session, cookie);
        params.put("or_status" , "6");
        Callback(path ,params ,cookie);
    }
    //获取已完成详情
    public void getFinish(){
        String path = UrlConstant.ORDER_LIST_URL;
        cookie = manage.get(KeyConstant.session, cookie);
        params.put("or_status" , "10");
        Callback(path ,params ,cookie);
    }
    //取消订单
    public void setCancel(String orId){
        String path = UrlConstant.CANCEL_URL;

        params.put("or_id" ,orId);
        Callback(path ,params ,cookie);
    }
    //评价订单
    public void setEvaluate(OrderJsonBean jsonBean){
        String path = UrlConstant.COMMENT_URL;

        params.put("or_id" ,jsonBean.getOr_id());
        params.put("content" ,jsonBean.getContent());
        params.put("fresh_gre" ,jsonBean.getFresh_gre());
        params.put("ser_att" ,jsonBean.getSer_att());
        params.put("dis_speed" ,jsonBean.getDis_speed());
        params.put("goodscommt" ,jsonBean.getObject() + "");
        Callback(path ,params ,cookie);
    }
    //删除订单
    public void setDelete(String id){
        String path = UrlConstant.REMOVE_URL;

        params.put("or_id" ,id);
        Callback(path ,params ,cookie);
    }
    //再次下单
    public void setDan(String id){
        String path = UrlConstant.REBUILD_URL;

        params.put("or_id" ,id);
        Callback(path ,params ,cookie);
    }
    //评价删除图片
    public void remove(String name){
        String path = UrlConstant.QINGCHU;

        params.put("source_name", name);
        Callback(path, params, cookie);
    }

}
